import React from 'react';
import { observer, inject } from 'mobx-react';
import { getEcCom } from '../../util/convert';

@inject('layoutStore')
@observer
export default class CheckElement extends React.Component{
    doChangeEvent = (value) => {
        const { layoutStore,fieldMark } = this.props;
		layoutStore.changeSingleFieldValue(fieldMark, {value: value});
	}
    render() {
        const { WeaCheckbox } = getEcCom();
        const { fieldMark,fieldAttr,symbol,rowIndex,cellObj,fieldObj } = this.props;
        let { baseProps } = this.props;
        if(baseProps.value === "")     
            baseProps.value = "0";
        return(
            <WeaCheckbox ecId={`${this && this.props && this.props.ecId || ''}_WeaCheckbox@s855yi`} 
                {...baseProps} 
                onChange={this.doChangeEvent}
            />
        )
    }
}